﻿<?xml version="1.0" encoding="utf-8"?>

<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <Entity type="NUnit:Mapping:Interfaces:Zoo" table="Zoo">

    <Id field="Id">
      <Generator name="guid" />
    </Id>

    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:Dog">
      <Rule parentField="Id" childTable="Nameables" childField="FK_Zoo" />
    </Reference>

    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:Human">
      <Rule parentField="Id" childTable="Nameables" childField="FK_Zoo" />
    </Reference>

  </Entity>
  
  <Entity type="NUnit:Mapping:Interfaces:Dog" discriminator-field="Type" discriminator-value="Dog" table="Nameables">
    
    <Id field="Id">
      <Generator name="guid" />
    </Id>

    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="Kind" field="Kind" db-type="String" size="50" scale="0" precision="0" not-null="false" />

    <Reference name="Toys" entityChild="NUnit:Mapping:Interfaces:Toy">
      <Rule parentField="Id" childTable="Toy" childField="FK_Owner" />
    </Reference>
    
  </Entity>

  <Entity type="NUnit:Mapping:Interfaces:Human" discriminator-field="Type" discriminator-value="Human" table="Nameables" >

    <Id field="Id">
      <Generator name="guid" />
    </Id>

    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="LastName" field="LastName" db-type="String" size="50" scale="0" precision="0" not-null="false" />

    <Reference name="Toys" entityChild="NUnit:Mapping:Interfaces:Toy">
      <Rule parentField="Id" childTable="Toy" childField="FK_Owner" />
    </Reference>

  </Entity>

  <Entity type="NUnit:Mapping:Interfaces:Toy" table="Toy" >

    <Id field="Id">
      <Generator name="guid" />
    </Id>

    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />

  </Entity>

</Mapping>